<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <script type="module">

        function getStockSymbol(name) {
            return new Promise(function (resolve,reject) {
                // resolve("aa");
                reject("eee");
                

            })
        }
        function getStockPrice(name) {
            return new Promise(function (resolve) {
                resolve(name + "__" + "bb");
            })

        }

        async function getStockPriceByName(name) {
            // await后面一般跟promise
            // symbol 是promise resove的结果
            const symbol = await getStockSymbol(name); 
            const stockPrice = await getStockPrice(symbol);
            return stockPrice;
        }

        getStockPriceByName('goog').then(function (result) {
            console.log(result);
        });

    </script>
</head>

<body>

</body>

</html>